From 8ed21d9d8d916309869bdbac56312188fbc6291b Mon Sep 17 00:00:00 2001 From: Kevin Albertson Date: Sat, 17 May 2025 09:52:36 -0400 Subject: [PATCH] test consuming CMake package --- .github/workflows/cmake.yml | 22 ++++++++++++++++++++++ .gitignore | 1 + test/app/CMakeLists.txt | 6 ++++++ test/app/app.c | 9 +++++++++ 4 files changed, 38 insertions(+) create mode 100644 test/app/CMakeLists.txt create mode 100644 test/app/app.c diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2881440..a9cc4cb 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -33,6 +33,21 @@ jobs: path: | build/libutf8proc.* build/Debug/utf8proc.* + - name: Test Consuming (Windows) + if: ${{ matrix.os == 'windows-latest' }} + run: | + cmake --install build --prefix tmp/install --config Debug + cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install + cmake --build test/app/build + $env:PATH+=";$PWD/tmp/install/bin" + test/app/build/Debug/app.exe + - name: Test Consuming (Unix) + if: ${{ matrix.os != 'windows-latest' }} + run: | + cmake --install build --prefix tmp/install + cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install + cmake --build test/app/build + test/app/build/app mingw: strategy: @@ -62,3 +77,10 @@ jobs: with: name: windows-mingw64 path: build/libutf8proc.* + - name: Test Consuming + run: | + cmake --install build --prefix tmp/install + cmake -S test/app -B test/app/build -DCMAKE_INSTALL_PREFIX=tmp/install -G'MSYS Makefiles' + cmake --build test/app/build + export PATH="$PATH:$(pwd)/tmp/install/bin" + test/app/build/app.exe diff --git a/.gitignore b/.gitignore index ab91d1d..d255134 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ /test/case /test/iscase /test/custom +/test/app/build /tmp/ /mingw_static/ /mingw_shared/ diff --git a/test/app/CMakeLists.txt b/test/app/CMakeLists.txt new file mode 100644 index 0000000..9d9786c --- /dev/null +++ b/test/app/CMakeLists.txt @@ -0,0 +1,6 @@ +# This is a test app to test consuming utf8proc with CMake. +cmake_minimum_required(VERSION 3.16) +project(utf8proc-test) +find_package(utf8proc REQUIRED) +add_executable(app app.c) +target_link_libraries(app utf8proc::utf8proc) diff --git a/test/app/app.c b/test/app/app.c new file mode 100644 index 0000000..4b6f8be --- /dev/null +++ b/test/app/app.c @@ -0,0 +1,9 @@ +#include +#include + +int +main(void) +{ + printf("%s\n", utf8proc_version()); + return 0; +} -- 2.30.2